<template>
	<div class="saying">
		<h3>一共有{{total}}条语录</h3>
		<button @click="addYulu">添加一个语录</button>
		<ul>
			<li v-for="y in list">{{y}}</li>
		</ul>
	</div>
</template>

<script>
	import {mapState,mapGetters} from 'vuex'
	export default {
		name:'Saying',
		computed:{
			...mapState('yulu',['list']),
			...mapGetters('yulu',['total'])
		},
		methods: {
			addYulu(){
				this.$store.dispatch('yulu/add')
			}
		},
	}
</script>

<style scoped>
	.saying{
		background-color: pink;
		padding: 20px;
	}
</style>